<template>
	<view class="device-list">
		<view class="device-cell" v-for="(item,index) in dataList" :key="index">
			<image class="device-icon" src="/static/device_icon.png" mode="aspectFit"></image>
			<view class="device-cell-content">
				<text>{{item.produceName}}-{{item.deviceTypeCode}}</text>
				<text class="device-code">{{item.ksnNo}}</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { onLoad,onPullDownRefresh } from '@dcloudio/uni-app'
	import { ref } from 'vue'
	import { getBindDeviceList } from '@/config/api.js'
	
	onLoad(()=>{
		getDeviceListData()
	})
	onPullDownRefresh(()=>{
		getDeviceListData()
	})
	const dataList = ref([])
	//获取机具列表
	const getDeviceListData = async ()=>{
		try{
			const res = await getBindDeviceList()
			dataList.value = res.result
			uni.stopPullDownRefresh()
		}catch(e){
			uni.stopPullDownRefresh()
		}
	}
</script>

<style lang="scss" scoped>
	
.device-list{
	padding: 30rpx;
	box-sizing: border-box;
	.device-cell{
		display: flex;
		align-items: center;
		background-color: white;
		border-radius: 15rpx;
		padding: 30rpx;
		.device-icon{
			width: 52rpx;
			height: 79rpx;
		}
		.device-cell-content{
			display: flex;
			flex-direction: column;
			margin-left: 30rpx;
			color: $xh-title-color;
			font-size: 28rpx;
			.device-code{
				color: $xh-subtitle-color;
				font-size: 24rpx;
				margin-top: 10rpx;
			}
		}
	}
}

</style>
